 <!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
	<head th:replace="_fragments::head(~{::title})">
		<meta charset="utf-8" />
		<title>博客管理</title>
		<script src="  https://cdn.bootcdn.net/ajax/libs/jquery/3.5.1/jquery.js " type="text/javascript" charset="utf-8"></script>
		<script src="https://cdn.jsdelivr.net/semantic-ui/2.2.4/semantic.min.js"></script>
		
		<link rel="stylesheet" href="https://cdn.jsdelivr.net/semantic-ui/2.2.4/semantic.min.css">

			<link rel="stylesheet" href="../../static/css/mi1.css">
	</head>
	<body>
		
		
		<nav th:replace="admin/_fragments::menu(1)" class="ui inverted attached segment m-padded-tb-mini m-shadow-small" >
			<div class="ui container">
			<div class="ui menu inverted secondary stackable">
				<h2 class="ui teal header item">管理后台</h2>
				<a href="#" class="m-item m-mobile-hide item"><i class="mini idea icon"></i>博客</a>
				<a href="#" class="m-item m-mobile-hide item"><i class="mini idea icon"></i>分类</a>
				<a href="#" class="m-item m-mobile-hide item"><i class="mini tags icon"></i>标签</a>
				<div class="right m-item m-mobile-hide menu">
					<div class="ui dropdown item">
						    <div class="text">
						      <img class="ui avatar image" src="http://temp.im/100x100">
						      脏丽丽
						    </div>
						    <i class="dropdown icon"></i>
						    <div class="menu">
						      <a href="#" class="item">注销</a>
						    </div>
						  
					</div>
				</div>
			</div>
			</div>
			<a href="#" class="ui black menu toggle icon button m-right-top m-mobile-show">
				<i class="sidebar icon"></i>
			</a>
		</nav>
		<div class="ui attached pointing menu">
			<div class="ui container">
				<div class="right menu">
			<a href="#" class="item" th:href="@{/admin/blogs/input}">发布</a>
			<a href="" class="teal active item " th:href="@{/admin/blogsShow}">列表</a>
					
				</div>
				
			</div>
		</div>
		<!-- 中间内容 -->
		<div class="m-container m-padded-tb-big">
			<!-- header -->
		    <div class="ui container">
				<form action="" method="post" class="ui segment secondary form">
					<input type="hidden" name="page">
					<div class="inline fields">
						<div class="field">
							<input type="text" name="title" placeholder="标题">
						</div>
						<div class="field">
							<div class="ui selection dropdown">

								<input type="hidden" name="typeId" >
								<i class="dropdown icon"></i>
								<div class="default text">分类</div>
							    <div class="menu" >
<!--									<div class="item" data-value="1" >错误日志</div>-->
<!--									<div class="item" data-value="1">错误日志</div>-->
<!--									<div class="item" data-value="2">开发者手册</div>-->
<!--									<div class="item" data-value="3">错误日志</div>-->
<!--									<div class="item" data-value="4">错误日志</div>-->
									<div class="item"  th:each="type : ${types} " th:data-value="${type.id}" th:value="${type.id}" th:text="${type.name}"></div>
								</div>
							</div>
						</div>
						<div class="field">
							
<!--							<div class="ui ">-->
<!--								<input type="checkbox" name="recommend" id="recommend" >-->
<!--								<lable for="recommend ">推荐</lable>-->
<!--								-->
<!--							-->
<!--						</div>-->
								
						
						</div>
					<div class="ui field">
						<button type="button " id="search-btn" class="ui teal basic button mini"><i class="icon search"></i>搜索</button>
					</div>
					</div>
				</form>
				<div id="table-container">
					<table th:fragment="blogList" class="ui compact teal table">
						<thead>
						<tr >
							<th >id</th>
							<th>标题</th>
							<th>类型</th>
							<th>推荐</th>
							<th>状态</th>
                            <th>更新时间</th>
							<th>操作</th>
						</tr>
						</thead>
						<tbody>
						<tr th:each="blog : ${pageInfo.getList()}">
							<td th:text="${blog.id}">1</td>
							<td th:text="${blog.title}">刻意联系清单</td>
							<td th:text="${blog.type.name}">认知升级</td>
							<td th:text="${blog.recommend} ? '否' : '是'">是</td>
                            <td th:text="${blog.published} ? '草稿' : '发布'">是</td>

                            <td th:text="${#dates.format(blog.updateTime,'yyyy-MM-dd') }">2017-10-12</td>

							<td>
								<a href="#" class="ui mini teal basic button" th:href="@{/admin/blogs/{id}/input(id=${blog.id})}">编辑</a>
								<a href="#" class="ui mini red basic button" th:href="@{/admin/blogs/{id}/delete(id=${blog.id})}">删除</a>

							</td>
						</tr>
						</tbody>
						<tfoot>

						<tr>
							<th colspan="7">
								<div class="ui mini pagination menu">
									<!--								<a class="item" th:href="@{/admin/blogs(pageNum=${pageInfo.hasPreviousPage}?${pageInfo.prePage}:1)}" th:unless="${pageInfo.isFirstPage}">上一页</a>-->
									<!--								<a class="item" th:href="@{/admin/blogs(pageNum=${pageInfo.hasNextPage}?${pageInfo.nextPage}:${pageInfo.pages})}" th:unless="${pageInfo.isLastPage}">下一页</a>-->
									<a class="item" th:href="@{/admin/blogsShow(pageNum=${pageInfo.hasPreviousPage}?${pageInfo.prePage}:1)}" th:unless="${pageInfo.isFirstPage}">上一页</a>
									<a class="item" th:href="@{/admin/blogsShow(pageNum=${pageInfo.hasNextPage}?${pageInfo.nextPage}:${pageInfo.pages})}" th:unless="${pageInfo.isLastPage}">下一页</a>
									<!--									<a class="item" onclick="page(this)"  th:attr=" data-page=@{/admin/blogsShow(pageNum=${pageInfo.hasPreviousPage}?${pageInfo.prePage}:1)} " th:unless="${pageInfo.isFirstPage}">上一页</a>-->
									<!--									<a class="item" onclick="page(this)"   th:attr="data-page=@{/admin/blogsShow(pageNum=${pageInfo.hasNextPage}?${pageInfo.nextPage}:${pageInfo.pages})}" th:unless="${pageInfo.isLastPage}">下一页</a>-->

								</div>
								<a href="" class="ui teal basic button right floated" th:href="@{/admin/blogs/input}">新增</a>
							</th>
						</tr>


						</tfoot>
					</table>

					<div class="ui success message" th:unless="${#strings.isEmpty(message)}">
						<i class="close icon">
						</i>
						<div class="header">提示</div>
						<p th:text="${message}"></p>
					</div>
				</div>
			</div>
		</div>
		<br />
		<br />
		<br />
		<footer th:replace="_fragments::footer" class="ui inverted vertical segment m-padded-tb-massive">
			<div class="ui center aligned  container">
			<div class="ui inverted divided grid stackable">
				<div class="three wide column">
					<div class="inverted ui link list">
					<div class="item">
						<img src="../../static/img/小俊男.jpg" style="width:110px " alt="" class="ui rounded image">
						
					</div>
					</div>
				</div>
				<div class="three wide column">
					<div class="ui inverted link list">
						<h4 class="ui inverted header m-text-thin m-text-spaced">最新博客</h4>
						<a href="#" class="item">用户登录</a>
						<a href="#" class="item">用户登录</a>
						<a href="#" class="item">用户登录</a>
					</div>
					
				</div>
				<div class="three wide column">
					<div class="ui inverted link list">
						<h4 class="ui inverted header m-text-thin m-text-spaced" >最新博客</h4>
						<a href="#" class="item">用户登录</a>
						<a href="#" class="item">用户登录</a>
						<a href="#" class="item">用户登录</a>
					</div>
					
				</div>
				<div class="seven wide column">
					<div class="ui inverted link list">
						<h4 class="ui inverted header m-text-thin m-text-spaced">最新博客</h4>
						<p  class="m-text-thin m-text-spaced m-opacity-mini">这是脏丽丽的个人博客！里面有好多好玩的东西哟！</p>
					</div>
					
				</div>
				
			</div>
			<div class="ui inverted section divider"></div>
			<p class="m-text-thin m-text-spaced m-opacity-tiny">copy right 2019-2020</p>
			</div>
			
		</footer>
		<script>
			$('.menu.toggle').click(function() {
				$('.m-item').toggleClass('m-mobile-hide');
			});
			
			$('.ui.dropdown').dropdown(
			{
				on:'hover'
			}
			);

			$('.message .close').on('click',function () {
				$(this)
						.closest('.message')
						.transition('fade');
			});
			$("#search-btn").click(function () {
				$("[name='page']").val(0);
				loaddata();
			});
			function page(obj) {
				$("[name='page']").val($(obj).data("page"));
				loaddata();
			}
				function loaddata() {
				$("#table-container").load( /*[[@{/admin/blogs/search}]]*/ "/admin/blogsShow",
						{
							title : $("[name='title']").val(),
							typeId : $("[name='typeId']").val(),
							page : $("[name='page']").val()
						})
			}
		</script>
			<th:block th:replace="_fragments::script">

		</th:block>
	</body>
</html>
